<?php
class ClientOrder extends ClientOrderPeer
{
	function ClientOrder()
	{
		parent::ClientOrderPeer();
	}
	
	
	public static function getAllOrders($invoice_id)
	{
		$database = new Database();
		if ($active != 1)
			$active = 0;
		if ($invoice_id)
			$query = "SELECT id FROM client_order WHERE invoice_id=$invoice_id";
		else
			$query = "SELECT id FROM client_order";
		$result = $database->query($query);
		$ids = $database->fetch_array($result);
		$client_orders = array();
		foreach ($ids as $id) {
			$order = new ClientOrder();
			$order->select($id['id']);
			$client_orders[] = $order;
		}
		return $client_orders;
	}
}
?>